layui.use(['form','layer','laydate','table','laytpl'],function(){
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery,
        laydate = layui.laydate,
        laytpl = layui.laytpl,
        table = layui.table;

    var tableIns = table.render({
    	elem: '#operationLog',
        url : '/operation/list',
        cellMinWidth : 150,
        page : true,
        height : "full-125",
        limit : 10,
        limits : [10,15,20,25],
        id : "operationLog",
        cols : [[
            {field: 'userName', title: '操作人', align:"center"},
            {field: 'url', title: '接口地址',align:"center"},
            {field: 'title', title: '内容', align:'center'},
            {field: 'params', title: '参数', align:'center'},
            {field: 'method', title: '请求方法', align:'center'},
            {field: 'creatTime', title: '操作时间', align:'center'}
        ]]
    });
    var begin,end,keys

    
    $('#button').on('click', function(){
    	keys=$("#keys").val();
		table.reload("operationLog",{
			  page: {
				  curr: 1 //重新从第 1 页开始
			  },
			  where: {
				  startTime:begin,
				  endTime:end,
				  keys:keys
			  }
		  })
	  });
    
	  //执行一个laydate实例
	  laydate.render({
	    elem: '#begin' //指定元素
	    ,type:'datetime'
	    ,done: function(value, date, endDate){
		   	// console.log(value);
			begin=value //得到日期生成的值，如：2017-08-18
		}
	  });
	  laydate.render({
	    elem: '#end' //指定元素
	    ,type:'datetime'
	   ,done: function(value, date, endDate){
	   		// console.log(value);
	   		end=value //得到日期生成的值，如：2017-08-18
	   	}
	  });
})
